package com.zhuss.controller.product;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.product.line.CreateLineBo;
import com.zhuss.bean.bo.product.line.DeleteLineBo;
import com.zhuss.bean.bo.product.line.UpdateLineBo;
import com.zhuss.bean.bo.product.preline.CreatePrelineSignBo;
import com.zhuss.bean.bo.product.preline.DeletePrelineSignBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.OperateService;
import com.zhuss.exception.DzcxException;
import com.zhuss.product.line.LineOperateServiceExt;


/**
 * @description: 线路操作的Controller
 * @author: zhushanshuo
 * @create: Wed Dec 30 13:08:49 CST 2020
 **/
@RestController
@RequestMapping("/line")
public class LineOperateController extends BaseController {
	
	@Autowired
	@Qualifier("lineOperateService")
	private OperateService<Void, Object> lineOperateService;
	
	@Autowired
	@Qualifier("lineOperateServiceExt")
	private LineOperateServiceExt lineOperateServiceExt;
	
	@Autowired
	@Qualifier("prelineSignOperateService")
	private OperateService<Void, Object> prelineSignOperateService;
	
	
	/**
	 * 新线招募报名
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/createSign")
    public void createSign(@RequestBody CreatePrelineSignBo bo) throws DzcxException {
		
		prelineSignOperateService.create(bo);
    }
	
	/**
	 * 新线招取消报名
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
  @PostMapping("/deleteSign")
  public void delete(@RequestBody DeletePrelineSignBo bo) throws DzcxException {
		
		prelineSignOperateService.delete(bo);
  }
	
	/**
	 * 创建
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/create")
    public void create(@RequestBody CreateLineBo bo) throws DzcxException {
		
		lineOperateService.create(bo);
    }
	
	
	/**
	 * 修改
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/update")
    public void update(@RequestBody UpdateLineBo bo) throws DzcxException {
		
		lineOperateService.update(bo);
    }
	
	/**
	 * 删除
	 * @param bo
	 * @throws DzcxException
	 */
	@ResponseBody
    @PostMapping("/delete")
    public void delete(@RequestBody DeleteLineBo bo) throws DzcxException {
		
		lineOperateService.delete(bo);
    }
	
}
